import 'package:any_reader/public.dart';
import 'package:any_reader/views/home/components/boot_item.dart';

class BookListView {
  final List<Book> list;
  final BookSheetModel model;
  BookListView({@required this.list, @required this.model});
  List<Widget> toList() {
    var gridCount = list.length < 14 ? 14 : list.length;
    var _listView = <Widget>[];
    for (var index = 0; index < gridCount; index++) {
      if (index < list.length) {
        //添加格子
        var _item = BookItem(item: list[index], model: model);
        _listView.add(_item);
      } else {
        //添加空格子
        var _item = VoidItem();
        _listView.add(_item);
      }
    }
    return _listView;
  }
}
